import { createStore, applyMiddleware, combineReducers } from 'redux'
// 这个包可以允许我们既使用redux调试工具,又使用redux-thunk
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import countReducer from './components/Count/redux/reducer'
import listReducer from './components/List/redux/reducer'
// 注意: 实际开发中一定会有多个reducer函数,但是创建store的时候,只能传入一个reducer.所以我们需要将多个reducer函数,合并成一个reducer
// 注意: 合并reducer之后,redux中store的数据结构发生变化. 所以在组件中过滤数据时一定要根据最新的结构进行获取.其他代码都不需要做任何修改

const rootReducer = combineReducers({
  zs: countReducer,
  ls: listReducer,
})
export default createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
)
